/*
	FileName : app_usb.h
	Description : 
	
	Created on 2013.11.15 by ZZP.
	
	Revision History:
	
*/



/**
  ******************************************************************************
  * @file    usbh_usr.h
  * @author  MCD Application Team
  * @version V2.0.0
  * @date    22-July-2011
  * @brief   Header file for usbh_usr.c
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __APP_USB_H__
#define __APP_USB_H__

/* Includes ------------------------------------------------------------------*/
///#include "ff.h"
#include "usbh_core.h"
///#include "stm32_eval.h"
#include <stdio.h>
///#include "usbh_msc_core.h"

/** @addtogroup USBH_USER
  * @{
  */

/** @addtogroup USBH_MSC_DEMO_USER_CALLBACKS
  * @{
  */

/** @defgroup USBH_USR
  * @brief This file is the Header file for usbh_usr.c
  * @{
  */ 


/** @defgroup USBH_USR_Exported_Types
  * @{
  */ 


void AppTaskUsb(void *p_arg);
void MonitorUSB(void);
///extern  USBH_Usr_cb_TypeDef USR_cb;



/**
  * @}
  */ 



/** @defgroup USBH_USR_Exported_Defines
  * @{
  */ 
/* State Machine for the USBH_USR_ApplicationState */
#define USH_USR_FS_INIT       0
#define USH_USR_FS_READLIST   1

#define USH_USR_FS_WRITEFILE  2
#define USH_USR_FS_DRAW       3

#define USH_USR_FS_XFER_DIGITAL		4
#define USH_USR_FS_XFER_JW			5
#define USH_USR_FS_XFER_TEST		6
#define USH_USR_FS_XFER_ANALOG		7
#define USH_USR_FS_EXIT				8

#define USH_USR_FS_NOTHING			0xff


#define USB_INFO_DATA				((uint32_t)0x2001FF00)

#define FILE_TYPE_STS				0
#define FILE_TYPE_ANA				1
#define FILE_TYPE_JW				2
#define FILE_TYPE_TEST				3

#define CFG_FILE_ID1				0x73546283
#define CFG_FILE_ID2				0x83736254
#define CFG_FILE_ID3				0x55aaaa55
#define CFG_FILE_ID4				0x61845596

#define COPY_STATUS_ID1				0x33789243
#define COPY_STATUS_ID2				0x43927833


typedef struct{
	
	uint32_t ID1;
	uint32_t ID2;
	
	uint16_t TrNo[2];
	uint32_t CopyTm;
	
	uint32_t JwSecStartNo;
	uint32_t JwSecCnt;
	
	/*uint32_t TestSecStartNo;
	uint32_t TestSecCnt;*/
	uint32_t KeySigSecStartNo;
	uint32_t KeySigFileCnt;
	
	
	uint32_t StsSecStartNo;
	uint32_t StsSecCnt;
	
	uint32_t SigSecStartNo;
	uint32_t MaxSigFileCnt;
	
	uint32_t Jw_CopyStart;
	uint32_t Jw_CopyCnt;
	
	/*uint32_t Test_CopyStart;
	uint32_t Test_CopyCnt;*/
	uint32_t KeyAnaFile_CopyStart;
	uint32_t KeyAnaFile_CopyCnt;
	
	uint32_t StsSec_CopyStart;
	uint32_t StsSec_CopyCnt;
	
	uint32_t AnaFile_CopyStart;
	uint32_t AnaFile_CopyCnt;
}SD_INFO, *pSD_INFO;


/**
  * @}
  */ 

/** @defgroup USBH_USR_Exported_Macros
  * @{
  */ 
/**
  * @}
  */ 

/** @defgroup USBH_USR_Exported_Variables
  * @{
  */ 
extern  uint8_t USBH_USR_ApplicationState ;


void SetUsbCopyInfo(void);
/**
  * @}
  */ 

/** @defgroup USBH_USR_Exported_FunctionsPrototype
  * @{
  */ /*
void USBH_USR_ApplicationSelected(void);
void USBH_USR_Init(void);
void USBH_USR_DeInit(void);
void USBH_USR_DeviceAttached(void);
void USBH_USR_ResetDevice(void);
void USBH_USR_DeviceDisconnected (void);
void USBH_USR_OverCurrentDetected (void);
void USBH_USR_DeviceSpeedDetected(uint8_t DeviceSpeed); 
void USBH_USR_Device_DescAvailable(void *);
void USBH_USR_DeviceAddressAssigned(void);
void USBH_USR_Configuration_DescAvailable(USBH_CfgDesc_TypeDef * cfgDesc,
                                          USBH_InterfaceDesc_TypeDef *itfDesc,
                                          USBH_EpDesc_TypeDef *epDesc);
void USBH_USR_Manufacturer_String(void *);
void USBH_USR_Product_String(void *);
void USBH_USR_SerialNum_String(void *);
void USBH_USR_EnumerationDone(void);
USBH_USR_Status USBH_USR_UserInput(void);
void USBH_USR_DeInit(void);
void USBH_USR_DeviceNotSupported(void);
void USBH_USR_UnrecoveredError(void);
int USBH_USR_MSC_Application(void);

int USBH_USR_MSC_CopyData(void);*/

/**
  * @}
  */ 

#endif /*__USH_USR_H__*/

/**
  * @}
  */ 

/**
  * @}
  */ 

/**
  * @}
  */ 

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/




